<?php
namespace app\user\controller;
use think\Input;
class Index extends Common{
    public function initialize(){
        parent::initialize();

    }
    public function index(){
        $this->assign('title','会员中心');
		//获取所有的用户信息
		$user=db('users')->where('id='.$_SESSION['think']['user']['id'])->find();
		$level=getulevel($user['level']);
		if($level['level']==3||$level['level']==4){
		    $max=db('baodan')->where('userid',$user['id'])->max('num');
/*		    echo $max;
		    die();*/
		    if($max*$level['lsk']>5000){
                $this->assign('fwzx',1);
            }

        }elseif($level['level']==5||$level['level']==6){
            $max=db('baodan')->where('userid',$user['id'])->max('num');
            if($max*$level['lsk']>10000){
                $this->assign('fwzx',1);
            }
        }elseif($level['level']==7||$level['level']==8){
            $max=db('baodan')->where('userid',$user['id'])->max('num');
            if($max*$level['lsk']>150000){
                $this->assign('fwzx',1);
            }
        }
        $lname=$level['level_name'];

		$this->assign('user',$user);
		$this->assign('lname',$lname);
        return $this->fetch();
    }
}